<?php require_once('../../core/import.php');?>
<?php User::Permission('MEMBER_PERMISSION_LIST'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
    <script type="text/javascript" src="../../scripts/import.js"></script>
    <script type="text/javascript" src="../../scripts/components/checkbox/import.checkbox.js"></script>
    <script type="text/javascript" src="../../scripts/components/zebra_table/import.zebra_table.js"></script>
    <script type="text/javascript" src="scripts/member.list.js"></script>
</head>

<body>
	<table width="98.5%" id="List" border="0" align="center" cellpadding="0" cellspacing="0" class="List">        
    <thead>
    <tr >
        <th width="20%" align="center" valign="middle">&nbsp;名称</th>
        <th width="20%" align="center" valign="middle">&nbsp;权限值</th>
        <th width="35%" align="center" valign="middle">&nbsp;链接地址</th>
        <th width="10%" align="center" valign="middle">&nbsp;排序值</th>
        <th width="15%" align="center" valign="middle">&nbsp;操作</th>
    </tr>
    </thead>
  	<form id="Form1" name="Form1" method="post" >   
    <tbody>
    <?php
        #获取数据
        $Data=DB::GetData('select Identifying,Name,Role,URL,Identifying_Parent,RealSort,Branch from management_user_permission where Identifying_Parent is null order by RealSort asc limit ?,10');
	  foreach($Data['Record'] as $Row)
        {
		//  $Name=urlencode($Row['Name']);
		//  $URL=urlencode($Row['URL']);
    ?>
    <tr>
        <td height="30" align="center" valign="middle">
            <input type="text" id="Name_<?php echo $Row['Identifying'];?>" name="Name_<?php echo $Row['Identifying'];?>"  class="TextboxAdd" value="<?php echo $Row['Name'];?>" />
        </td>
        <td align="center" valign="middle">
           <input type="text" id="Role_<?php echo $Row['Identifying'];?>" name="Role_<?php echo $Row['Identifying'];?>"  class="TextboxAdd" value="<?php echo $Row['Role'];?>" />
        </td>
        <td align="center" valign="middle">
           <input type="text" id="URL_<?php echo $Row['Identifying'];?>" name="URL_<?php echo $Row['Identifying'];?>" size="50" class="TextboxAdd" value="<?php echo $Row['URL'];?>" />
        </td>
        <td align="center" valign="middle">
           <input type="text" id="RealSort_<?php echo $Row['Identifying'];?>" name="RealSort_<?php echo $Row['Identifying'];?>" size="10" class="TextboxAdd" value="<?php echo $Row['RealSort'];?>" />
        </td>
        <td height="25" align="center" valign="middle">
            <a href="javascript:Edit(<?php echo $Row['Identifying'];?>);">修改</a>
            <a href="javascript:mconfirm_delete('member.permission.action.delete.php?id=<?php echo $Row['Identifying'];?>');">删除</a>
        </td>
    </tr>
   <?php
        #获取数据
        $Data_Branch=DB::GetData('select Identifying,Name,Role,URL,Identifying_Parent,RealSort,Branch from management_user_permission where Identifying_Parent='.$Row['Identifying'].' and Branch=1 order by Identifying asc limit ?,20');
	  foreach($Data_Branch['Record'] as $Branch_Row)
        {
    ?>
    <tr>
        <td height="30" align="center" valign="middle">
           &nbsp;&nbsp;&nbsp;&nbsp;<img src="styles/Fminus.gif" /> <input type="text" id="Name_<?php echo $Branch_Row['Identifying'];?>" name="Name_<?php echo $Branch_Row['Identifying'];?>"  class="TextboxAdd" value="<?php echo $Branch_Row['Name'];?>" />
        </td>
        <td align="center" valign="middle">
           <input type="text" id="Role_<?php echo $Branch_Row['Identifying'];?>" name="Role_<?php echo $Branch_Row['Identifying'];?>"  class="TextboxAdd" value="<?php echo $Branch_Row['Role'];?>" />
        </td>
        <td align="center" valign="middle"><input type="hidden" id="URL_<?php echo $Branch_Row['Identifying'];?>" name="URL_<?php echo $Branch_Row['Identifying'];?>" value="" /></td>
        <td align="center" valign="middle">
        <input type="hidden" id="RealSort_<?php echo $Branch_Row['Identifying'];?>" name="RealSort_<?php echo $Branch_Row['Identifying'];?>" value="" />
        </td>
        <td height="25" align="center" valign="middle">
            <a href="javascript:Edit(<?php echo $Branch_Row['Identifying'];?>);">修改</a>
            <a href="javascript:mconfirm_delete('member.permission.action.delete.php?id=<?php echo $Branch_Row['Identifying'];?>');">删除</a>
        </td>
    </tr>
    <?php
			}
        }
    ?>
    </tbody> 
    <tfoot>
    <tr>
    	 <td height="25" colspan="5" align="left" valign="middle">
    		<table width="98.5%" id="List" align="center" border="0" cellpadding="0" cellspacing="0" class="List">
   		  <tr bgcolor="#CCCCCC" height="30">
        		<td align="left" width="8%"> &nbsp;模块添加 </td> 
     			  <td align="left" width="20%">
       			&nbsp;名 &nbsp;称：
<input type="text" id="Name_Add" name="Name_Add"  class="TextboxAdd" />
     			  </td> 
                    <td align="left" width="25%">
      		 	&nbsp;权限值： <input type="text" id="Role_Add" name="Role_Add"  class="TextboxAdd" />
     			  </td>
     			  <td align="left" width="35%">
      		 	&nbsp;链接地址： <input type="text" id="URL_Add" name="URL_Add" size="40" class="TextboxAdd" />
     			  </td>
     			  <td align="left" width="6%">
       			<span id="LinkAdd" class="Cursor_Pointer"><font size="3">添加</font></span>
     			  </td>
  		 </tr> 
         <tr>
         	<td colspan="5"><hr /></td>
         </tr> 
          <tr bgcolor="#CCCCCC" height="30">
        		  <td align="left" width="6%"> &nbsp;子模块添加</td> 
                  <td height="30" width="10%" align="left" valign="middle">
                  &nbsp;父模块：
                  <select name="Branch_Class" size="1" id="Branch_Class">
                    <option value="">--请选择模块--</option> 
                    <?php	
                    $Branch_Class=DB::GetRows('select Identifying,Name from `management_user_permission` where Identifying_Parent is null order by RealSort asc');
                          foreach($Branch_Class as $ClassID)
                          {
                          ?>
                           <option value="<?php echo $ClassID['Identifying'];?>" <?php if($ClassID['Identifying']==$Row['Identifying_Parent']){ echo 'selected="selected"' ;}?>> <?php echo $ClassID['Name'];?></option>
					  <?php 
                          }
                      ?>
                  </select>
                  </td>
     			  <td align="left" width="25%">
       			 &nbsp;名 &nbsp;称： 
       			 <input type="text" id="Branch_Name" name="Branch_Name" size="40" class="TextboxAdd" />
     			  </td> 
                    <td align="left" width="35%">
      		 	 &nbsp;权 限 值：
      		 	 <input type="text" id="Branch_Role" name="Branch_Role" size="40" class="TextboxAdd" />
     			  </td>
     			  <td align="left" width="5%">
       			<span id="BranchAdd" class="Cursor_Pointer"><font size="3">添加</font></span>
     			  </td>
  		 </tr>  
   		</table>
    	</td>
    </tr>
    </tfoot>   
   <tfoot>
    <tr>
        <td height="25" colspan="5" align="center" valign="middle">
            <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td width="55%" align="left">
                <?php
                    PagerFactory::Create('Simple')->Display($Data);
                ?>
                </td>
            </tr>
            </table>    
         </td>
	</tr>
    </tfoot>
    </form>
    </table> 


</body>
</html>